package com.lh.user.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.annotation.Generated;
import javax.persistence.*;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;


/**
 * @author liuhe
 * @date 2020/07/02
 */
@Getter
@Setter
@Table(name = "tb_user")
@ToString
public class UserDo implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Length(min = 4, max = 30, message = "用户名只能在4~30之前")
    private String username;

    @JsonIgnore
    @Length(min = 4, max = 30, message = "密码只能在4~30位之间")
    private String password;

    @Pattern(regexp = "^1[35678]\\d{9}$", message = "手机号格式不正确")
    private String phone;
    /**
     * 创建时间
     */
    private Date created;
    /**
     * 密码加密盐值
     */
    @JsonIgnore
    private String salt;
}
